# coding=utf-8
from gm.api import *
import numpy as np
import talib

set_token("90be3f863b23ab3c1ef68d1f9b8dc06e4bebb30d")

data = history_n(symbol="SZSE.399006",
                 frequency="60s",
                 count=100,
                 end_time="2017-12-31",
                 fields="close",
                 fill_missing='last',
                 adjust=ADJUST_PREV,
                 df=True
                 )
close = np.asarray(data['close'].values)
ma3 = talib.MA(close, timeperiod=5)

print(ma3)

# if __name__ == '__main__':
#     run(strategy_id='a5299b24-8b44-11e9-a4d4-b499baf0193a',
#         filename='Quant.py',
#         mode=MODE_BACKTEST,
#         token='90be3f863b23ab3c1ef68d1f9b8dc06e4bebb30d',
#         backtest_start_time='2016-06-17 13:00:00',
#         backtest_end_time='2017-08-21 15:00:00')
